package com.realife.ysuper.controller;

import com.realife.common.utils.R;
import com.realife.ysuper.entity.OrderLogisticsEntity;
import com.realife.ysuper.service.OrderLogisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;



/**
 * 
 *
 * @author Albert
 * @email 15962463559@163.com
 * @date 2020-06-05 10:04:15
 */
@Slf4j
@RestController
@RequestMapping("/ysuper/orderlogistics")
public class OrderLogisticsController {

    @Autowired
    private OrderLogisticsService orderLogisticsService;



    /**
     * 信息
     */
    @RequestMapping("/info/{orderId}")
    //@RequiresPermissions("ysuper:orderlogistics:info")
    public R info(@PathVariable("orderId") Long orderId){
		OrderLogisticsEntity orderLogistics = orderLogisticsService.getById(orderId);

        return R.ok().put("orderLogistics", orderLogistics);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("ysuper:orderlogistics:save")
    public R save(@RequestBody OrderLogisticsEntity orderLogistics){
		orderLogisticsService.save(orderLogistics);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("ysuper:orderlogistics:update")
    public R update(@RequestBody OrderLogisticsEntity orderLogistics){
		orderLogisticsService.updateById(orderLogistics);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("ysuper:orderlogistics:delete")
    public R delete(@RequestBody Long[] orderIds){
		orderLogisticsService.removeByIds(Arrays.asList(orderIds));

        return R.ok();
    }

}
